<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<p>用户名：<input type="text" id="username" /></p>
		<p>密码：<input type="password" id="pwd" /></p>
		<input type="button" value="注册" onclick="register()" />
		<script src="js/jmessage-sdk-web-2.1.0.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/jquery-1.11.0.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
				var JIM = new JMessage();
			window.onload = function() {
				init();
			}
				
				
			function init(){
				JIM.init({
					"appkey": "239a00294f23757f90151429",
					"random_str": "022cd9fd995849b58b3ef0e943421ed9",
					"signature": "D97C2DDA3E46E5E6D482E9E8EE84AF93",
					"timestamp": "1467967210887"
				}).onSuccess(function(data) {
//					console.log('success:' + JSON.stringify(data));
				}).onFail(function(data) {
					console.log('error:' + JSON.stringify(data))
				});
			}
			function register() {
				var username = $("#username").val();
				var pwd = $("#pwd").val();
				JIM.register({
					'username': username,
					'password': pwd,
					'is_md5': false
				}).onSuccess(function(data) {
//					console.log('success:' + JSON.stringify(data));
					console.log("注册成功");
					location.href = "index.html";
				}).onFail(function(data) {
					console.log('error:' + JSON.stringify(data));
					console.log("注册失败");
				});
			}
		</script>
	</body>

</html>